# 银行类
class Bank:
    def __init__(self, bank_name):
        self.bank_name = bank_name
        self.users = {}  # 存储用户信息的字典
        self.max_users = 100  # 最大用户数
    #添加用户
    def add_user(self, user):
        if user.account in self.users:
            return 2  # 用户已存在
        if len(self.users) >= self.max_users:
            return 3  # 用户库已满
        self.users[user.account] = user
        return 1  # 添加成功
    #存款
    def deposit(self, account, amount):
        if account not in self.users:
            return False
        self.users[account].balance += amount
        return True
    #取款
    def withdraw(self, account, password, amount):
        if account not in self.users:
            return 1  # 账号不存在
        if self.users[account].password != password:
            return 2  # 密码不对
        if self.users[account].balance < amount:
            return 3  # 钱不够
        self.users[account].balance -= amount
        return 0  # 正常
    #转账
    def transfer(self, from_account, to_account, password, amount):
        if from_account not in self.users or to_account not in self.users:
            return 1  # 账号不对
        if self.users[from_account].password != password:
            return 2  # 密码不对
        if self.users[from_account].balance < amount:
            return 3  # 钱不够
        self.users[from_account].balance -= amount
        self.users[to_account].balance += amount
        return 0  # 正常

    #查询账户信息
    def query_account(self, account, password):
        if account not in self.users:
            print("该用户不存在。")
            return
        if self.users[account].password != password:
            print("密码错误。")
            return
        user = self.users[account]
        print(f"当前账号：{user.account}, 密码:xxxxxx, 余额：{user.balance}元，"
              f"用户居住地址：{user.address.street} {user.address.house_number} {user.address.province} {user.address.country}，"
              f"当前账户的开户行：{user.bank_name}.")